<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>Cadastro de usuários</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="pt-br">
		<style type="text/css">
			body{ font-family: Verdana;}
			#box{padding-left: 10px; padding-right: 10px; padding-bottom: 10px; width: 300px; margin: 20px auto; background: #c0c0c0}
			#box p{margin-bottom: 3px; font-size: 11px; font-weight: bold}
			#box h1{padding: 5px; color: #ffffff; font-size: 16px; text-align: center; background: #000000; filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;opacity: 0.7;}
			.msg{ width: 300px; margin: 20px auto; background: red; text-align: center; font-weight: bold; padding: 10px}
			.msg2{ width: 300px; margin: 20px auto; background: blue; color: #ffffff; text-align: center; font-weight: bold; padding: 10px}
		</style>
		
		<script type="text/javascript">
			function doSalva()
			{
				var usuario = document.getElementById("usuario");
				var email = document.getElementById("email");
				
				if(usuario.value.length<3)
				{
					alert("Digite o usuário corretamente");
					usuario.focus();
					return false;
				}
				else if(email.value.length < 3)
				{
					alert("Digite o e-mail corretamente");
					email.focus();
					return false;
				}
				else
					return true;
				
			}
			
			function mostraSaida()
			{
				msg={{ msg }};
				idMsg = document.getElementById("msg");
				resp="";
				if(idMsg)
				{
					switch(msg){
						case 1:
							resp="Cadastro efetuado!";
							style="msg2";
							break;
						case 2:
							resp="E-mail solicitado já está cadastrado";
							style="msg";
							break;
						case 3:
							resp="Digite os dados corretamente!";
							style="msg";
							break;
					}
					
					if(resp!="")
					{
						idMsg.style.visibility="visible";
						idMsg.innerHTML = resp;
						idMsg.className=style;
					}
					else
					{
						idMsg.style.visibility="hidden";
					}
				}
				
			}
		</script>
		
	</head>
	
	<body onload="document.getElementById('usuario').focus(); mostraSaida()">
			
		<form action="cad" method="post" id="frm" onSubmit="return doLogin()">
			<div id="box">
				<h1>Cadastro de usuário</h1>
				
				<p>Nome:</p>
				<input id="usuario" type="text" name="usuario" maxlength="20" size="20">
				
				<p>E-mail (Google):</p>
				<input id="email" type="text" name="email" maxlength="60" size="30">
				
				<p>Perfil:</p>
				<select name="perfil">
						<option value="2"> DESENVOLVEDOR </option>
						<option value="1"> ADMIN </option>
				</select>
				
				<p>UF:</p>
				<select name="uf">
						<option value="ac">Acre</option>
						<option value="al">Alagoas</option>
						<option value="ap">Amapá</option>
						<option value="am">Amazonas</option>
						<option value="ba">Bahia</option>
						<option value="ce">Ceará</option>
						<option value="df">Distrito Federal</option>
						<option value="es">Espirito Santo</option>
						<option value="go">Goiás</option>
						<option value="ma">Maranhão</option>
						<option value="ms">Mato Grosso do Sul</option>
						<option value="mt">Mato Grosso</option>
						<option value="mg">Minas Gerais</option>
						<option value="pa">Pará</option>
						<option value="pb">Paraíba</option>
						<option value="pr">Paraná</option>
						<option value="pe">Pernambuco</option>
						<option value="pi">Piauí</option>
						<option value="rj">Rio de Janeiro</option>
						<option value="rn">Rio Grande do Norte</option>
						<option value="rs">Rio Grande do Sul</option>
						<option value="ro">Rondônia</option>
						<option value="rr">Roraima</option>
						<option value="sc">Santa Catarina</option>
						<option value="sp">São Paulo</option>
						<option value="se">Sergipe</option>
						<option value="to">Tocantins</option>
				</select><br><br>
				
				<input type="submit" value="Cadastra">
				<input type="hidden" name="acao" value="grava">
				
			</div>
			
			<div id="msg" style="visibility: hidden"></div>
				
		</form>
		
		
	</body>
</html>

